home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / doc / sigprc04 < prev    next >
Text File  |  1997-07-08  |  916b  |  30 lines

  1. ; This batch file creates a plot of the magnitude and phase
  2. ; of the simulated signal used in the example from Chapter 13,
  3. ; "Signal Processing", of _Using IDL_.
  4.  
  5. @sigprc01.bat ; compute time data sequence u
  6.  
  7. V = FFT(U) ; compute spectrum v
  8.  
  9. F = FINDGEN(N/2+1) / (N*delt) ; f = [0.0, 1.0/(N*delt), ... , 1.0/(2.0*delt)]
  10.  
  11. mag = ABS(V(0:N/2)); magnitude of first half of v
  12.  
  13. phi = ATAN(V(0:N/2)) ; phase of first half of v
  14.  
  15. ; log plots of magnitude in dB and phase in degrees
  16.  
  17. !P.MULTI = [0, 1, 2] ; set up for two plots in window
  18.  
  19. PLOT, F, 20*ALOG10(mag), YTITLE='Magnitude in dB', $
  20.     XTITLE='Frequency in cycles / second', /XLOG, $
  21.     XRANGE=[1.0,1.0/(2.0*delt)], XSTYLE=1, TITLE='Spectrum of u(k)'
  22.  
  23. PLOT, F, phi/!DTOR, YTITLE='Phase in degrees', $
  24.     YRANGE=[-180,180], YSTYLE=1, YTICKS=4, YMINOR=3, $
  25.     XTITLE='Frequency in cycles / second', /XLOG, $
  26.     XRANGE=[1.0,1.0/(2.0*delt)], XSTYLE=1
  27.  
  28. !P.MULTI = 0
  29.  
  30.